package com.wongoing.test.apiclienttest;

import java.io.UnsupportedEncodingException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.junit.Test;


public class AlipayTester {
	@Test
	public void alipay() {
		String WIDout_trade_no = "201711201591122";
		String WIDtotal_amount = "0.01";
		String WIDsubject = "测试";
		String WIDbody = "";
		String notify_url = "";
		String resturnUrl = "";
		try {
			  Matcher matcher = Pattern.compile("(h5_route_token=\\\\\".+?&is_h5_route=\\\\\"true\\\\\")").matcher("var data = {\"requestType\":\"SafePay\",\"fromAppUrlScheme\":\"alipays\",\"dataString\":\"h5_route_token=\\\"RZ134aOiKEeou5dX0gMCKH2TAEGowxmobilecashierRZ13\\\"&is_h5_route=\\\"true\\\"\"};");
		  
//			  System.out.println(matcher.group());
			// 按指定模式在字符串查找
		      String line = "This order was placed for QT3000! OK?";
		      String pattern = "(This)(\\d+)(.*)";
		 
		    
		      //Matcher m =Pattern.compile("(h5_route_token=\\\\\".+?&is_h5_route=\\\\\"true\\\\\")").matcher("var data = {\"requestType\":\"SafePay\",\"fromAppUrlScheme\":\"alipays\",\"dataString\":\"h5_route_token=\\\"RZ134aOiKEeou5dX0gMCKH2TAEGowxmobilecashierRZ13\\\"&is_h5_route=\\\"true\\\"\"};");
		      // 现在创建 matcher 对象
		      //Matcher m = Pattern.compile("(This)(\\d+)(.*)").matcher(line);
		     // if (matcher.find()) {
		          System.out.println(matcher.group(0) );
		         System.out.println(matcher.group(1) );
		      //}
			  //String result = AlipayHelper.payResult(WIDout_trade_no,WIDtotal_amount,WIDsubject,WIDbody,notify_url,resturnUrl);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
}
